package com.java110.mall.cart.bmo.businessQuery.impl;

import com.alibaba.fastjson.JSONObject;
import com.java110.dto.vipUser.ShopVipUserDto;
import com.java110.intf.shop.IShopVipUserInnerServiceSMO;
import com.java110.mall.cart.bmo.businessQuery.IBusinessQueryVip;
import com.java110.utils.util.ListUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessQueryVipImpl implements IBusinessQueryVip {

    @Autowired
    private IShopVipUserInnerServiceSMO shopVipUserInnerServiceSMOImpl;

    @Override
    public void queryVipByName(JSONObject reqJson,String searchValue,String shopId, List<ShopVipUserDto> allShopVipUserDtos) {
        ShopVipUserDto shopVipUserDto = new ShopVipUserDto();
        shopVipUserDto.setVipNameLike(searchValue);
        shopVipUserDto.setShopId(shopId);
        shopVipUserDto.setPage(1);
        shopVipUserDto.setRow(20);
        List<ShopVipUserDto> shopVipUserDtos = shopVipUserInnerServiceSMOImpl.queryShopVipUsers(shopVipUserDto);
        if(ListUtil.isNull(shopVipUserDtos)){
            return;
        }
        allShopVipUserDtos.addAll(shopVipUserDtos);
    }

    @Override
    public void queryVipByTel(JSONObject reqJson,String searchValue,String shopId, List<ShopVipUserDto> allShopVipUserDtos) {
        ShopVipUserDto shopVipUserDto = new ShopVipUserDto();
        shopVipUserDto.setVipTel(searchValue);
        shopVipUserDto.setShopId(shopId);
        shopVipUserDto.setPage(1);
        shopVipUserDto.setRow(20);
        List<ShopVipUserDto> shopVipUserDtos = shopVipUserInnerServiceSMOImpl.queryShopVipUsers(shopVipUserDto);
        if(ListUtil.isNull(shopVipUserDtos)){
            return;
        }
        allShopVipUserDtos.addAll(shopVipUserDtos);
    }
}
